package com.usian.article.controller;

import com.usian.apis.article.ApArticleControllerApi;
import com.usian.article.service.ApArticleService;
import com.usian.model.article.pojos.ApArticle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/article")
public class ApArticleController implements ApArticleControllerApi {

    @Autowired
    private ApArticleService articleService;

    @PostMapping("/save")
    @Override
    public ApArticle saveArticle(@RequestBody ApArticle apArticle) {
        articleService.save(apArticle);
        return apArticle;//传进来什么就可以直接返回什么
    }

    @GetMapping("/findById/{id}")
    public ApArticle findByfindByArticleId(@PathVariable Integer id){
      return  articleService.getById(id);
    }

}